package xj.graph2d.command;

import xj.graph2d.DrawShape;
import xj.graph2d.SimpleDrawDocument;
import xj.graph2d.SimpleDrawView;

public class MoveLineEndCommand extends DeltaCommand {

  public static final int LINE_END_1 = 101;

  public static final int LINE_END_2 = 102;

  public MoveLineEndCommand(SimpleDrawView view, SimpleDrawDocument doc,
			    DrawShape shape, int pos) {
    super(view, doc, shape);
    this.pos = pos;
  }

  @Override
  protected void forward() {
    switch (pos) {
    case LINE_END_1:
      shape.moveEnd1(x, y);
      break;
    case LINE_END_2:
      shape.moveEnd2(x, y);
      break;
    }
  }

  @Override
  protected void backward() {
    switch (pos) {
    case LINE_END_1:
      shape.moveEnd1(-x, -y);
      break;
    case LINE_END_2:
      shape.moveEnd2(-x, -y);
      break;
    }
  }

  protected int pos;

}
